<include file="__PUBLIC__/head.html"/>
<css file="__PUBLIC__/css/arc.css"/>
<script type="text/javascript">
    $(function(){
        //异步置顶推荐
        $(".edit_attr input").change(function(){
            var check = $(this).attr("checked")
            if(check){
                var value = 1
            }else{
                var value = 0
            }
            $.ajax({
                type: "POST",
                url: "__CONTROL__/ajaxEdit",
                data: "arc_id="+$(this).attr("arc_id")+"&"+$(this).attr("name")+"="+value,
                success: function(msg){
                    if(msg>=1){
                        prompt(".promp","更改成功","#FEC400","1000")
                    }else{
                        prompt(".promp","更改失败","#ccc","1000")
                    }                    
                }
            })
        })
        
        //全选效果 
        $("#selectall").toggle(function(){
            $(".select input").attr({checked:"checked"})
        },function(){
            $(".select input").removeAttr("checked")
        })
        
        //筛选刷新页面
        $("#choose").change(function(){
            var choose_val=$(this).val()
            window.location.replace("__CONTROL__/index/cat_id/"+choose_val)
        })
        
        //排序
        $(".sort").focusout(function(){
            var thiss = $(this)
            var arc_sort = $(this).attr("value")
            var arc_id = $(this).attr("arc_id")
            if($(this).attr("value")!=$(this).attr("valueload")){
                $.post("__CONTROL__/ajaxEdit", { arc_sort:arc_sort, arc_id: arc_id },
                function(msg){
                    if(msg>=1){
                        prompt(".promp","更改成功","#FEC400","1000")
                        thiss.attr("valueload",arc_sort)
                    }else{
                        prompt(".promp","更改失败","#ccc","1000")
                    }                    
                });
             }   
        })
        //批量删除
        $(".operate .dels").click(function(){
            if(confirm('确实要删除该内容吗?')){
              $("#del").submit();  
            }
            return false;
        })
        //删除提示
        $("tr td .del").click(function(){
            if(!confirm('确实要删除该内容吗?'))return false;
        })
        //更改状态
        $(".edit_attr .show,.hide").click(function(){
            var thisa = $(this)
            var id = $(this).attr("valu")
            var sta = $(this).attr("class")
            if(sta=="show"){
                $.post("__CONTROL__/ajaxEdit",{arc_id:id,arc_sta:"hide"},function(mgs){
                    if(mgs>=1){
                        prompt(".promp","操作成功","#FEC400","1000")
                        thisa.removeClass("show").addClass("hide")
                    }else{
                        prompt(".promp","操作失败","#ccc","1000")
                    }
                })
            }else{
                $.post("__CONTROL__/ajaxEdit",{arc_id:id,arc_sta:"show"},function(mgs){
                    if(mgs>=1){
                        prompt(".promp","操作成功","#FEC400","1000")
                        thisa.removeClass("hide").addClass("show")
                    }else{
                        prompt(".promp","操作失败","#ccc","1000")
                    }
                })
            }
        })
        
        
        
        
        
        
    })
    
    //提示函数
    function prompt (objs,cont,col,time){
        var obj=$(objs)
        var widths=$(obj).width()?100:$(obj).width()
        var tops=($(window).height()-$(obj).height())/2
        var lefts=($(window).width()-widths)/2
        obj.show();
        obj.css({
            opacity:0.6,
            position: "absolute",
            background: col,
            top:tops,
            left:lefts,
            padding:"15px"
        })
        obj.text(cont);
        setTimeout(function(){
            obj.fadeOut(time)
        }, time);
    }   
</script>
<style>
    
</style>
</head>
<body>
    <form id="del" action="__CONTROL__/del" method="get">
    <div class="operate"> 
        <a href="#" class="dels">批量删除</a>
        <select id="choose">
            <option>==所有频道==</option>
            <list from="$category" name="$c">
            <if value="$c.cat_id==$cid">
                <option value="{$c.cat_id}" selected="selected">{$c.html}{$c.cat_name}</option>
                <else>
                    <option value="{$c.cat_id}">{$c.html}{$c.cat_name}</option>
            </if>
            </list>
        </select>
    </div>
    <table class="table1">
        <thead>
            <tr>
                <td width="30" align="center"><a href="#" title="点击全选中" id="selectall"/>全选</a></td>
                <td width="30" align="center">ID</td>
                <td align="center" width="40">排序</td>
                <td align="center">标题</td>
                <td width="100" align="center">所属栏目</td>
                <td width="100" align="center">发表时间</td>
                <td width="260" align="center">操作</td>
            </tr>
        </thead>
        <list from="$arc" name="$a">
        <tr>
            <td align="center" class="select"><input type="checkbox" name="arc_id[]" value="{$a.arc_id}"/></td>
            <td align="center">{$a.arc_id}</td>
            <td align="center" width="50"><input arc_id="{$a.arc_id}" class="sort" value="{$a.arc_sort}" valueload="{$a.arc_sort}"/></td>
            <td><a href="__CONTROL__/edit_show/arc_id/{$a.arc_id}" title="点击修改">{$a.title}</a></td>
            <td  align="center"><a href="__METH__/cat_id/{$a.cat_id}">{$a.cat_name}</a></td>
            <td align="center">{$a.addtime|date:"Y-m-d",@@}</td>
            <td class="edit_attr" valign="middle" align="center">
        <div title="点击更改状态" class="{$a.arc_sta}" valu="{$a.arc_id}"></div>
        <if value="$a.is_ding==1">
            <label><input arc_id="{$a.arc_id}" value=1 type="checkbox" checked="checked" name="is_ding" class="is_ding"/><span>置顶</span></label>
            <else>
                <label><input arc_id="{$a.arc_id}" value=1 type="checkbox" name="is_ding" class="is_ding"/><span>置顶</span></label>
        </if>
        &nbsp;&nbsp;
        <if value="$a.is_tui==1">
            <label><input arc_id="{$a.arc_id}" value=1 type="checkbox" checked="checked" name="is_tui" class="is_tui"/><span>推荐</span></label>
            <else>
                <label><input arc_id="{$a.arc_id}" value=1 type="checkbox" name="is_tui" class="is_tui"/><span>推荐</span></label>
        </if> 
        &nbsp;|&nbsp;
        <a href="__ROOT__/index.php/index/arc/arc_id/{$a.arc_id}" target="_new">预览</a>  &nbsp;|&nbsp;
        <a class="del" href="__CONTROL__/del/arc_id/{$a.arc_id}">删除</a>
    </td>
</tr>
</list>
</table>
<div class="page">{$page}</div>
<div class="promp"></div>
</form>
</body>
</html>
































